<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
%>
<html>
<head>

<link rel="stylesheet" type="text/css"
	href="<%=path%>/script/easyUI-1.4/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/script/easyUI-1.4/themes/icon.css">
<script type="text/javascript"
	src="<%=path%>/script/easyUI-1.4/jquery-3.2.1.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/script/easyUI-1.4/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/script/easyUI-1.4/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" charset="utf-8"
	src="<%=path%>/script/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
	src="<%=path%>/script/utf8-jsp/ueditor.all.min.js">
	
</script>
<script type="text/javascript" charset="utf-8"
	src="<%=path%>/script/utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
		$(function(){
			
			var marker = "${marker}";
			
			if(marker!=""){
				//邮件为添加好友的邮件，启用“同意按钮”
				$("#btn").css("visibility","visible");
			}
			
			
			//拒绝按钮
			$("#jujueBtn").bind("click",function(){
				
				$.messager.confirm('提示','是否拒绝好友？',function(r){    
				    if (r){    
				    	$("#btn").css("visibility","hidden");
				    	$("#btn").remove();
				    }
				});  
			});
			
			//同意按钮
			$("#tongyiBtn").bind("click",function(){
				
				  $.ajax({
			           //几个参数需要注意一下
			               type: "POST",//方法类型
			               dataType: "json",//预期服务器返回的数据类型
			               url: "<%=path%>/userAction/addFriend?sendUserId=${email.senduserid}",
			               success: function (result) {
			            	   $.messager.alert('提示',result.msg); 
			            	   $("#btn").remove();
			               	
			               },
			               error : function() {
			                   alert("系统异常！");
			               }
			           });
				
			});
			
		});

</script>

</head>
<body class="easyui-layout" >
 
 <div id="top" data-options="region:'north'" style="height:200px;margin-left: 100px;" >
 	<div id="title">
 	
 		<h4>标题： &nbsp;&nbsp;&nbsp;&nbsp;${email.title}</h4>
 	</div>
 	<div id="sendUserName">
 		<h4>发件人：&nbsp;&nbsp;&nbsp;&nbsp;${sendUserName}</h4>
 	</div>
 	<div id="sendTime">
 		<h4>发送时间：&nbsp;&nbsp;&nbsp;&nbsp;${email.sendtime}</h4>
 	</div>
 </div>
 
    <div id="content"  data-options="region:'center'" style="padding:5px;background:#eee;font-size: 15px;">
    	<div>${email.content}</div>
    	<div style="margin-left: 40px;margin-top: 150px;visibility: hidden;" id="btn">
    		<a id="tongyiBtn" class="easyui-linkbutton"
					data-options="iconCls:'icon-ok'" style="width: 80px;; height: 32px">同意</a>
					<a id="jujueBtn" class="easyui-linkbutton"
					data-options="iconCls:'icon-ok'" style="width: 80px; height: 32px;margin-left: 20px;">拒绝</a>
    	</div>
    </div>  
    
      <div data-options="region:'east',split:true" style="width:100px;"></div>   
    <div data-options="region:'west'" style="width:100px;"></div>   
</body>

</html>